import { Pane } from "tweakpane";

const pane = new Pane();

const PARAMS = {
  percentage: 50,
  theme: "dark",
  time: "15:48:29",
  wave: 0.77,
};

// `min` and `max`: slider
pane.addBinding(PARAMS, "percentage", {
  min: 0,
  max: 100,
  step: 10,
  label: "百分比",
});

// `options`: list
pane.addBinding(PARAMS, "theme", {
  options: { Dark: "dark", Light: "light" },
  label: "主题",
});

pane.addBinding(PARAMS, "wave", {
  label: "波形",
  readonly: true,
  multiline: true,
  rows: 5,
  view: "graph",
  min: -1,
  max: +1,
});

// 定时器 100ms 刷新
setInterval(() => {
  PARAMS.wave = Math.random();
}, 100);
